package com.yangtao.framework.common;

import com.yangtao.framework.util.JsonUtil;

import java.io.Serializable;
import java.util.List;

/**
 * ajax调用的标准返回值
 *
 * @author: 杨涛
 * @date: 11-5-29 上午12:10
 * @version: 1.0
 */
public class AjaxResult implements Serializable {
	/**
	 * 状态
	 * 0 成功
	 * 1 警告
	 * 2 错误
	 */
	private int state;
	/**
	 * 返回消息列表
	 */
	private List<SimpleMessage> messages;
	/**
	 * 返回的数据
	 */
	private Object data;

	public void wrap(Object object) {
		this.data = object;
	}

	public AjaxResult() {
	}

	public AjaxResult(Object data) {
		this.data = data;
	}

	public AjaxResult(List<SimpleMessage> messages, int state) {
		this.messages = messages;
		this.state = state;
	}

	public AjaxResult(int state, List<SimpleMessage> messages, Object data) {
		this.state = state;
		this.messages = messages;
		this.data = data;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public List<SimpleMessage> getMessages() {
		return messages;
	}

	public void setMessages(List<SimpleMessage> messages) {
		this.messages = messages;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
